home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 001a / mumail12.tz / mumail12 / mumail / SeDecl.h < prev    next >
C/C++ Source or Header  |  1993-04-20  |  11KB  |  397 lines

  1. /*---------------------------------------------------------------------------+
  2. |    This file is part of the MuMail, Copyright (c) 1992-1993 by
  3. |    Muhammad M. Saggaf. All rights reserved.
  4. |
  5. |    See the file COPYING (1-COPYING) or the manual page mumail(1)
  6. |    for a full statement of rights and permissions.
  7.  */
  8.  
  9. #include <stdio.h>
  10. #include <X11/Intrinsic.h>
  11.  
  12. extern Boolean  do_script(),
  13.                 DoToggleCapture(),
  14.                 SeGetToggleState();
  15. extern char    *str_strip_lead_end_space(),
  16.                *str_strip_lead_space(),
  17.                *str_strip_end_space(),
  18.                *str_stripspc_copy(),
  19.                *StripSpace(),
  20.                *FmtString(),
  21.                *GetFirstWord(),
  22.                *GetNextWord(),
  23.                *expand_fname(),
  24.                 itoa(),
  25.                *mport(),
  26.                 MdmReadChar(),
  27.                 TermReadChar(),
  28.                 read_seyon_file();
  29. extern long     mbaud();
  30. extern int      open_modem(),
  31.                 trminp(),
  32.                 io_get_attr(),
  33.                 io_set_attr(),
  34.                 io_flush(),
  35.                 io_send_break(),
  36.                 lock_tty(),
  37.                 SeFork(),
  38.                 coninp(),
  39.                 read_mbyte(),
  40.                 dial_number(),
  41.                 redial(),
  42.                 readbyte(),
  43.                 MdmSetGetBaud(),
  44.                 MdmSetGetCSize(),
  45.                 MdmSetGetParity(),
  46.                 MdmSetGetStopBits(),
  47.                 MdmSetGetIStrip(),
  48.                 MdmSaveRestoreAttr(),
  49.                 Online(),
  50.                 SuspContTerminal(),
  51.                 get_modem_fio();
  52. extern FILE    *open_file(),
  53.                *open_file_va();
  54. extern void     send_break(),
  55.                 usleep(),
  56.                 show(),
  57.                 showf(),
  58.                 SeyonMessage(),
  59.                 SeyonMessagef(),
  60.                 close_modem(),
  61.                 StartTerminal(),
  62.                 KillTerminal(),
  63.                 RestartTerminal(),
  64.                 getword(),
  65.                 se_warning(),
  66.                 se_warningf(),
  67.                 SeError(),
  68.                 SeErrorF(),
  69.                 SePError(),
  70.                 SePErrorF(),
  71.                 SeNotice(),
  72.                 SeNoticeF(),
  73.                 setup_signal_handlers(),
  74.                 exec_close_script(),
  75.                 io_set_speed(),
  76.                 s_exit(),
  77.                 unlock_tty(),
  78.                 SeSetUnsetToggle(),
  79.                 ProcRequest(),
  80.                 write_child_info(),
  81.                 writef_child_info(),
  82.                 exec_cmd(),
  83.                 ShellCommand(),
  84.                 ExecShellCommand(),
  85.                 sendbyte(),
  86.                 send_tbyte(),
  87.                 send_slowly(),
  88.                 sendf_slowly(),
  89.                 cancel_dial(),
  90.                 SeBeep(),
  91.                 Beep(),
  92.                 SeSetViewportDimFromMultiList(),
  93.                 get_dial_info(),
  94.                 TopDial(),
  95.                 SeSetDialogValue(),
  96.                 xc_setflow(),
  97.                 set_rtscts(),
  98.                 RemoveCurrentItem(),
  99.                 DialCirculate(),
  100.                 DialerEnd(),
  101.                 read_file(),
  102.                 read_pipe_data(),
  103.                 write_pipe_data(),
  104.                 read_close_file(),
  105.                 dial(),
  106.                 sync_modem_attr(),
  107.                 PortToTty(),
  108.                 do_exit(),
  109.                 get_line(),
  110.                 getline(),
  111.                 lc_word(),
  112.                 toggle_flag(),
  113.                 cpmode(),
  114.                 set_onoff(),
  115.                 SetStatusMessage(),
  116.                 set_modem_fio(),
  117.                 set_modem_attr(),
  118.                 get_modem_attr(),
  119.                 mattach(),
  120.  
  121.                 MdmIFlush(),
  122.                 MdmPurge(),
  123.                 MdmHangup(),
  124.                 MdmPutString(),
  125.  
  126.                 DestroyShell(),
  127.                 DestroyShellCallBack(),
  128.                 EditFile(),
  129.                 ExecProcRequest(),
  130.                 ExecExit(),
  131.                 SePopupNoticeF(),
  132.                 SeSetViewportDimFromList(),
  133.                 SeSetViewportDimensions(),
  134.                 SetStatusMessagef(),
  135.                 SeSetWidgetWidth(),
  136.                 SeSetWidgetHeight(),
  137.                 SeSetValue(),
  138.                 SeSetLabel(),
  139.                 restore_orig_mode(),
  140.                 GetWord(),
  141.                 FunMessage(),
  142.                 IdleGuard(),
  143.                 mprintf(),
  144.                 PopupError(),
  145.  
  146.                 kill_w_child(),
  147.                 ChildKillInternal(),
  148.                 ChildKillExternal(),
  149.                 w_exit_up(),
  150.                 w_kill_up(),
  151.                 PreProcessPrep(),
  152.                 PostProcessPrep(),
  153.                 SetKillButtonSens(),
  154.  
  155.                 ReadCommentedFile(),
  156.                 FreeList(),
  157.                 UpdateStatusBox(),
  158.                 CenterShell(),
  159.                 CenterShellOnRoot(),
  160.                 PositionShell(),
  161.                 ResetFlag(),
  162.                 SetSensitiveOn(),
  163.                 set_tty_mode();
  164. extern Widget   GetShell(),
  165.                 SePopupDialogGetString(),
  166.                 SeAddButton(),
  167.                 AddButton(),
  168.                 SeAddButtonWithClientData(),
  169.                 SeAddButtonWCD(),
  170.                 SeAddLabel(),
  171.                 SeAddToggle(),
  172.                 SeAddToggleWCD(),
  173.                 SeCreatePopup(),
  174.                 SeCreateTopLevelPopup(),
  175.                 SeAddDialog(),
  176.                 AddBox(),
  177.                 SeAddBox(),
  178.                 SeAddForm(),
  179.                 SeAddPaned(),
  180.                 AddPaned(),
  181.                 SeAddPopupWG(),
  182.                 SeAddPopup(),
  183.                 AddSimplePopup(),
  184.                 SeAddPopupOffset(),
  185.                 SeAddPopupUL(),
  186.                 SePopupNotice(),
  187.                 SePopupRadio(),
  188.                 PopupDialogGetValue(),
  189.                 SePopupDialogGetString(),
  190.                 SePopupDialogGetStringE();
  191. extern Dimension SeWidgetWidth(),
  192.                 SeWidgetHeight();
  193.  
  194. /*
  195.  *   Apprarently these two are not ANSI?
  196.  */
  197. #if __STDC__ == 1 && defined(SVR4)
  198. extern int      kill(),
  199.                 fileno();
  200. #endif
  201.  
  202. #if HAVE_TERMIOS
  203. extern struct termios oldmode,
  204.                 newmode;
  205. #else
  206. #if HAVE_TERMIO
  207. extern struct termio oldmode,
  208.                 newmode;
  209. #else
  210. #if HAVE_SGTTYB
  211. extern struct sgttyb oldmode,
  212.                 newmode;
  213. #endif
  214. #endif
  215. #endif
  216.  
  217. /*
  218.  * defined constants
  219.  */
  220.  
  221. #define VERSION "2.1"
  222. #define REVISION "4b"
  223.  
  224. #define SUSPEND_TERM              18
  225. #define CONTINUE_TERM             19
  226. #define START_TERM                20
  227. #define START_AUTO_ZM             21
  228. #define SET_MESSAGE               22
  229. #define KILL_TERM                 23
  230. #define EXIT_PROGRAM              24
  231. #define EXEC_SCRIPT               25
  232. #define TOP_DIAL                  26
  233. #define POPUP_ERROR               27
  234. #define TOP_DIAL_START            28
  235. #define DISPATCH_ACTION           29
  236.  
  237. #define SHELLPOS_HWFH             1
  238.  
  239. #define TIN_BUF 20                /* number of chars in a tiny buffer */
  240. #define LIT_BUF 40                /* number of chars in a little buffer */
  241. #define SM_BUF  80                /* number of chars in a small buffer */
  242. #define REG_BUF 256                /* number of chars in a regular buffer */
  243. #define LRG_BUF 1024            /* number of chars in a large buffer */
  244.  
  245. #define MDELAY  50000            /* delay of output to modem in command mode */
  246.  
  247. #define ERR_MDM_NOMODEM             -1
  248. #define ERR_MDM_LOCKED              -2
  249. #define ERR_MDM_OPENFAILED          -3
  250. #define ERR_MDM_RESETFLAGSFAILED    -4
  251.  
  252. #define TERM_SUSPEND   0
  253. #define TERM_CONTINUE  1
  254.  
  255. #define ATTR_SAVE      0
  256. #define ATTR_RESTORE   1
  257.  
  258. #define ACTION_NEW_ACTION           1
  259. #define ACTION_NEW_ARG              2
  260. #define ACTION_ARGS_END             3
  261. #define ACTION_PARSE_ERROR          4
  262. #define ACTION_DISPATCH            10
  263.  
  264. /*
  265.  * Modem lines
  266.  */
  267.  
  268. #define NUM_MDM_STAT 8
  269.  
  270. #define MDM_LE    0x001
  271. #define MDM_DTR   0x002
  272. #define MDM_RTS   0x004
  273. #define MDM_ST    0x008
  274. #define MDM_SR    0x010
  275. #define MDM_CTS   0x020
  276. #define MDM_DCD   0x040
  277. #define MDM_RNG   0x080
  278. #define MDM_DSR   0x100
  279.  
  280. /*
  281.  * macros
  282.  */
  283.  
  284. #define SSpc(str) str_strip_lead_end_space(str)
  285.  
  286. #define min(a,b) ((a) < (b) ? (a) : (b))
  287. #define max(a,b) ((a) > (b) ? (a) : (b))
  288.  
  289. #define ret_if_up(w, up_fl) {if (up_fl) {SeBeep(w);    return;}}
  290. #define ReturnIfTrue(flag) {if (flag) {Beep();    return;}}
  291. #define ErrorIfBusy() {if(inhibit_child) {Beep(); \
  292.   SeyonMessage("Busy with Another Process"); return;}}
  293.  
  294. #define GET_ARG() {getword(); if (eof_flag) return;}
  295. #define GETTEST_ARG(cmd) {GET_ARG(); if (word[0] == '\0') { \
  296.   SeErrorF("Missing argument to the command `%s'", cmd, "", ""); \
  297.   eof_flag = 1; return;}}
  298.  
  299. #define PopupCentered(popup,parent) \
  300.   {CenterShell(popup,parent); XtPopupSpringLoaded(popup);}
  301. #define PopupCenteredOnRoot(popup) \
  302.   {CenterShellOnRoot(popup);  XtPopupSpringLoaded(popup);}
  303. #define SimpleError(message) {Beep(); SeyonMessage(message); return;}
  304. #define SimpleErrorF(fmt,a,b,c) {Beep(); SeyonMessagef(fmt,a,b,c); return;}
  305.  
  306. /*
  307.  * Resource structures
  308.  */
  309.  
  310. struct _quickKeyRes {
  311.   Boolean     visible;
  312.   String      action;
  313. };
  314.  
  315. struct QueryResources {
  316.   String          modems;
  317.   String          script;
  318.  
  319.   String          defaultBPS;
  320.   int             defaultBits;
  321.   int             defaultParity;
  322.   int             defaultStopBits;
  323.   Boolean         stripHighBit;
  324.   Boolean         backspaceTranslation;
  325.   Boolean         metaKeyTranslation;
  326.   Boolean         xonxoffFlowControl;
  327.   Boolean         rtsctsFlowControl;
  328.   String          newlineTranslation;
  329.  
  330.   String          dialPrefix;
  331.   String          dialSuffix;
  332.   String          dialCancelString;
  333.  
  334.   int             dialTimeOut;
  335.   int             dialDelay;
  336.   int             dialRepeat;
  337.  
  338.   String          connectString;
  339.   String          noConnectString[4];
  340.  
  341.   Boolean         hangupBeforeDial;
  342.   Boolean         dialAutoStart;
  343.   String          dialDirFormat;
  344.   String          defaultPhoneEntries;
  345.  
  346.   String          startupAction;
  347.   String          postConnectAction;
  348.   Boolean         autoZmodem;
  349.   String          autoZmodemAction;
  350.  
  351.   int             modemVMin;
  352.   Boolean         ignoreModemDCD;
  353.   Boolean         hangupViaDTR;
  354.   String          modemAttentionString;
  355.   String          modemHangupString;
  356.   Boolean         hangupConfirm;
  357.   Boolean         exitConfirm;
  358.  
  359.   String          defaultDirectory;
  360.   String          scriptDirectory;
  361.   String          startupFile;
  362.   String          phoneFile;
  363.   String          protocolsFile;
  364.   String          captureFile;
  365.   String          helpFile;
  366.  
  367.   int             modemStatusInterval;
  368.   Boolean         idleGuard;
  369.   int             idleGuardInterval;
  370.   String          idleGuardString;
  371.   Boolean         showFunMessages;
  372.   int             funMessagesInterval;
  373.   String         *funMessages;
  374. };
  375.  
  376. extern XtAppContext app_con;
  377. extern struct   QueryResources qres;
  378. extern Widget   topLevel,
  379.                 genericWidget;
  380. extern Widget   dialWidget;
  381.  
  382. extern Boolean  inhibit_child;
  383. extern char     captureFile[REG_BUF],
  384.                 modem_port[REG_BUF],
  385.                *lptr;
  386. extern int      newlineTrMode;
  387. extern int      child_pipe[2];
  388. extern pid_t    w_child_pid;
  389. extern pid_t    childProcPid;
  390.  
  391. extern int      quote_flag;
  392. extern int      linkflag,
  393.                 eof_flag;
  394. extern char     word[],
  395.                *wptr,
  396.                 line[];
  397.